﻿@using NewLife.Common;
@using XCode.Membership;
@{
    var user = ManageProvider.User as IUser ?? User.Identity as IUser;
}

@if (user != null)
{
    <div class="d-flex align-items-center mb-2" id="kt_header_user_menu_toggle">
        <div class="cursor-pointer symbol symbol-40px" data-kt-menu-trigger="click" data-kt-menu-overflow="true" data-kt-menu-placement="top-start" data-kt-menu-flip="top-end" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-dismiss="click">
            <a href="#" class="btn btn-custom btn-primary w-100 p-3" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-dismiss-="click">
                <!-- 用户头像 -->
                @if (!user.Avatar.IsNullOrEmpty())
                {
                    <img alt="Pic" src="@user.GetAvatarUrl()" class="rounded float-start w-30px h-30px">
                }
                else
                {
                    <span class="symbol-label font-size-h5">@user.Name.Substring(0, 1).ToUpper()</span>
                    <i class="symbol-badge bg-primary"></i>
                }
                <span class="btn-label p-4">@user.DisplayName (@user.Name) </span>
            </a>
        </div>
        <div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg menu-state-primary fw-bold py-4 fs-6 w-275px" data-kt-menu="true">
            <div class="menu-item p-0 px-3">
                <div class="menu-content p-0 d-flex align-items-center px-3">
                    <div class="symbol symbol-50px me-5">
                        <!-- 用户头像 -->
                        @if (!user.Avatar.IsNullOrEmpty())
                        {
                            <img alt="Pic" src="@user.GetAvatarUrl()">
                        }
                        else
                        {
                            <span class="symbol-label font-size-h5">@user.Name.Substring(0, 1).ToUpper()</span>
                            <i class="symbol-badge bg-primary"></i>
                        }
                    </div>
                    <div class="d-flex flex-column">
                        <div class="fw-bolder d-flex align-items-center fs-5">
                            @user.DisplayName (@user.Name)
                        </div>
                        <span class="badge badge-light-info text-start fs-8">@user.RoleName</span>
                        <a href="~/Admin/User/Info/@user.ID" class="text-muted text-hover-primary fs-7"> @user.Mail</a>
                    </div>
                </div>
            </div>
            <div class="menu-item p-0 px-3">
                <div class="menu-content p-0 d-flex align-items-center p-0 px-3">
                    <a href="~/Admin/User/Info/@user.ID" class="btn btn-icon btn-light-info m-1" title="账号信息"><i class="fas fa-user-edit fs-2"></i></a>
                </div>
            </div>
            <div class="separator my-2"></div>
            <div class="menu-item px-3 text-center">
                <a class="text-light" href="@NewLife.Cube.CubeSetting.Current.StartPage">
                    <span class="fs-10 fw-normal text-gray-700">V @SysConfig.Current.Version</span>
                </a>
            </div>
            <div class="menu-item px-5 mt-5">
                <a href="~/Admin/User/Logout" class="d-flex flex-column btn btn-outline btn-outline-dashed btn-outline-danger btn-active-light-danger">注销</a>
            </div>
        </div>
    </div>
}
